﻿// owner 蒋家伟

#pragma once

// qt
#include <QVariant>
#include <QObject>

// jsdk
#include "ThreadDeleter.h"
#include "TaskTransferWorker.h"

class QThread;
namespace jsdk
{
    class TaskTransferWorker;
    class TaskId;
    class TaskTransfer : public QObject
    {
        Q_OBJECT
    public:
        static TaskTransfer* get();
        ~TaskTransfer();
        /// \ brief 单个任务触发
        void taskReady(const TaskId& taskId) const;
        void taskReady() const;
    private:
        TaskTransfer();
    signals:
        void taskReadyRead(QVariant taskId) const;
        void taskReadyRead() const;
    private:
        // 工作对象与线程
        OwnerPtr<QThread, ThreadDeleter> m_opThread;
        OwnerPtr<TaskTransferWorker> m_opTaskTransferWorker;
    };
}